package gxb.test06;

import java.util.Random;
import java.util.Scanner;

public class Rock {
    public static void main(String[] args) {
        String personPlay;
        String computerPlay=null;
        int computerInt;
        Scanner sc = new Scanner(System.in);
        Random random = new Random();
        personPlay=sc.nextLine();
        // 让它小写
        personPlay = personPlay.toUpperCase();
        computerInt= random.nextInt(3);
        System.out.println("计算机随机生成的数字"+computerInt);
        switch (computerInt){
            case 0:
                computerPlay="R";
                break;
            case 1:
                computerPlay="S";
                break;
            case 2:
                computerPlay="P";
                break;
            default:
                break;
        }
        System.out.println("您的选择：" + personPlay);
        System.out.println("计算机的选择：" + computerPlay);
        if (personPlay.equals(computerPlay))
            System.out.println("It`s a tie !");
        else if (personPlay.equals("R")) {
            if (computerPlay.equals("S"))
                System.out.println("Rock crushes scissors. you win!!");
            else{
                System.out.println("Paper crushes rock. you lose!!");
            }
        } else if (personPlay.equals("S")) {
            if (computerPlay.equals("R"))
                System.out.println("Rock crushes scissors. you lose!!");
            else{
                System.out.println("Scissors crushes Paper. you win!!");
            }
        }else {
            if (computerPlay.equals("R"))
                System.out.println("Paper crushes rock. you win!!");
            else{
                System.out.println("Scissors crushes Paper. you lose!!");
            }
        }
        sc.close();
    }
}
